import numpy as np
import pandas as pd
from pandas import Series,DataFrame

import json

db = json.load(open('../datasets/usda_food/database.json'))
nutrients = []

for rec in db:
    fnuts = DataFrame(rec['nutrients'])
    fnuts['id'] = rec['id']
    nutrients.append(fnuts)

nutrients = pd.concat(nutrients, ignore_index=True)
nutrients = nutrients.drop_duplicates()

print nutrients

